<?php

/**
 * Форма регистрации нового пользователя
 */
/**
 * @todo Подумать над фильтрацией данных для полей формы регистрации
 */
class Registration_Form_Registration
        extends Zend_Form {

    public function init() {
        $this->setMethod('post')
                ->setAction('/registration');

        $login = new Zend_Form_Element_Text('Login');
        $login->addValidator(new Zend_Validate_Alnum());
        $login->setRequired(true);
        $login->addFilter(new Zend_Filter_StringToLower());
        $login->setLabel('Логин');

        $password = new Zend_Form_Element_Text('Password');
        $password->addValidator(new Zend_Validate_Alnum());
        $password->setRequired(true);
        $password->addFilter(new Zend_Filter_StringToLower());
        $password->setLabel('Пароль');

        $last_name = new Zend_Form_Element_Text('LastName');
        $last_name->setRequired(true);
        //$last_name->addFilter(new Zend_Filter_StringToLower());
        $last_name->setLabel('Фамилия');

        $first_name = new Zend_Form_Element_Text('FirstName');
        $first_name->setRequired(true);
        //$first_name->addFilter(new Zend_Filter_StringToLower());
        $first_name->setLabel('Имя');

        $third_name = new Zend_Form_Element_Text('ThirdName');
        $third_name->setRequired(true);
        //$third_name->addFilter(new Zend_Filter_StringToLower());
        $third_name->setLabel('Отчество');

        $mobile_phone = new Zend_Form_Element_Text('MobilePhone');
        $mobile_phone->addValidator(new Zend_Validate_Int());
        $mobile_phone->setRequired(true);
        $mobile_phone->setLabel('Мобильный');

        $pole = new Zend_Form_Element_Text('Pole');
        $pole->addValidator(new Zend_Validate_Int());
        $pole->setRequired(true);
        $pole->setLabel('Номер полюса');

        $patient_card = new Zend_Form_Element_Text('PatientCard');
        $patient_card->addValidator(new Zend_Validate_Int());
        $patient_card->setRequired(true);
        $patient_card->setLabel('Номер амбулаторной карты');

        $birth_day = new Zend_Form_Element_Text('Birthday');
        $birth_day->setRequired(true);
        $birth_day->setLabel('Дата рождения');

        $this->addElements(array(
            $login,
            $password,
            $last_name,
            $first_name,
            $third_name,
            $mobile_phone,
            $pole,
            $patient_card,
            $birth_day,
            new Zend_Form_Element_Submit('Отправить заявку')
        ));
    }

}